const mongoose = require('mongoose')
mongoose.connect('mongodb://127.0.0.1:27017/htmlxjg')
//schema字段符
const GoodsSchema = new mongoose.Schema({
    name:{
        type:String,
        minlength:1,
        required:true
    },
    price:{
         type:Number,
         required:true
    },
    num:{
        type:Number,
        default: 0 
    }
})
//模型创建
const GoodsModel = mongoose.model('Goods',GoodsSchema,'goods')
module.exports = GoodsModel